import { createRouter, createWebHistory } from "vue-router"
import login from "../views/login.vue"
import Admin from "../views/admin.vue"
import Welcome from "../views/admin/welcome.vue"
import Chapter from "../views/admin/chapter.vue"
import Section from "@/views/admin/section";
import Course from "@/views/admin/course";
import Category from "@/views/admin/category";
import Teacher from "@/views/admin/teacher";
import File from "@/views/admin/file";

const routerHistory = createWebHistory()

const router = createRouter({
    "history": routerHistory,
    "routes": [
        {
            path: "/:(*)*",
            redirect: "/login"
        },
        {
            "path": "/login",
            "component": login
        },
        {
            "path": "/",
            "name": "admin",
            "component": Admin,
            children: [
                {
                    "path": "welcome",
                    "name": "welcome",
                    "component": Welcome,
                },
                {
                    "path": "business/course",
                    "name": "business/course",
                    "component": Course,
                },
                {
                    "path": "business/chapter",
                    "name": "business/chapter",
                    "component": Chapter,
                },
                {
                    "path": "business/section",
                    "name": "business/section",
                    "component": Section,
                },
                {
                    "path": "business/category",
                    "name": "business/category",
                    "component": Category,
                },
                {
                    "path": "business/teacher",
                    "name": "business/teacher",
                    "component": Teacher,
                },
                {
                    "path": "business/file",
                    "name": "business/file",
                    "component": File,
                }
            ]
        }
    ]
})

export default router